
Ext.onReady(function(){
    var currentSeatNumber = 1;
    /*
    var customerNameTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{name} {phone}</h3>', '</div></tpl>');
    var customerNameStore = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
            url: "/customers/getCustomersLikeName"
        }),
        reader: new Ext.data.JsonReader({
            root: 'root'
        }, ['id','name','phone'])
    });
    var customerName = new Ext.form.ComboBox({
        store: customerNameStore,
        fieldLabel: '客户',
        name: 'customer_name',
        allowBlank: true,
        blankText: "客户姓名不允许为空",
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: customerNameTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            //customerName.setValue(record.data.name);
            addMul_customer_id = record.data.id;
            //alert(addMul_customer_id);
            var pars = paramStr.substring(paramStr.indexOf("&"));
            //alert(pars);
            paramStr = "customerid=" + addMul_customer_id + pars;
            //alert(paramStr);
            if (this.isExpanded()) {
                this.collapse();
            }
        },
        value: addMul_customer_name
    });
    */
    var customerName = new Ext.form.TextField({
        fieldLabel: '客户',
        name: 'customer_name',
        anchor: '90%',
        readOnly: true,
        value: addMul_customer_name
    });
    var orderRequest = new Ext.form.TextField({
        fieldLabel: '客户要求',
        name: 'order_request',
        anchor: '90%'
    });
    var flightInfo = new Ext.form.TextField({
        fieldLabel: '航班信息',
        name: 'flight_info',
        anchor: '90%',
        readOnly: true,
        value: flightInfoStr
    });
    var flightInfo2 = new Ext.form.TextField({
        fieldLabel: '返程/联程',
        name: 'flight_info2',
        anchor: '90%',
        readOnly: true,
        value: flightInfoStr2
    });
    var flightInfo3 = new Ext.form.TextField({
        fieldLabel: '回程',
        name: 'flight_info3',
        anchor: '90%',
        readOnly: true,
        value: flightInfoStr3
    });
    var flightInfo4 = new Ext.form.TextField({
        fieldLabel: '回程联程',
        name: 'flight_info4',
        anchor: '90%',
        readOnly: true,
        value: flightInfoStr4
    });
    //出票类型
    var HKFixType = new Ext.form.Radio({
        fieldLabel: '出票类型',
        name: 'fix_type',
        id: 'fix_type_hk',
        boxLabel: 'HK',
        checked: true,
        inputValue: 'HK'
    });
    var RRFixType = new Ext.form.Radio({
        name: 'fix_type',
        id: 'fix_type_rr',
        boxLabel: 'RR',
        checked: false,
        hideLabel: true,
        inputValue: 'RR'
    });
    function adjustRR(){
        if (RRFixType.getGroupValue() == 'RR') {
            ticketNo.allowBlank = false;
            tktlDate.allowBlank = true;
            tktlTime.allowBlank = true;
            Ext.getCmp('div_tktl').hide();
            Ext.getCmp('div_ticketno').show();
            outTicketStatus.setValue(TICKET_STATUS_QRCP);
            outTicketStatus.disable();
        }
        else {
            ticketNo.allowBlank = true;
            tktlDate.allowBlank = false;
            tktlTime.allowBlank = false;
            Ext.getCmp('div_ticketno').hide();
            Ext.getCmp('div_tktl').show();
            outTicketStatus.enable();
        }
    }
    RRFixType.on('check', adjustRR);
    var LLFixType = new Ext.form.Radio({
        name: 'fix_type',
        id: 'fix_type_ll',
        boxLabel: 'LL',
        checked: false,
        hideLabel: true,
        inputValue: 'LL'
    });
    var outTicketStatus = new Ext.form.ComboBox({
        store: new Ext.data.Store({
            reader: new Ext.data.ArrayReader({}, ['value']),
            data: [[TICKET_STATUS_WQR], [TICKET_STATUS_QRCP], [TICKET_STATUS_LJCP]]
        }),
        name: 'status',
        fieldLabel: '出票状态',
        resiable: true,
        typeAhead: true,
        width: 90,
        handleHeight: 100,
        displayField: 'value',
        valueField: 'value',
        nameField: 'status',
        selectOnFocus: true,
        mode: 'local',
        selectOnFocus: true,
        triggerAction: 'all', //这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        emptyText: '选择类型...',
        //allowBlank: false,
        //blankText: "出票状态必须选择",
        value: TICKET_STATUS_WQR
    });
    var affirmDate = new Ext.form.DateField({
        fieldLabel: 'COF',
        name: 'affirm_date',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: false,
        blankText: "确认日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90,
        minValue: today,
        value: today
    });
    var tktlDate = new Ext.form.DateField({
        fieldLabel: '出票时限',
        name: 'tktl_date',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: false,
        blankText: "出票时限必须选择",
        emptyText: '请选择...',
        inputType: '2008-01-01',
        editable: false,
        minValue: today,
        width: 90
    });
    var tktlTime = new Ext.form.TimeField({
        fieldLabel: '时限时间',
        name: 'tktl_time',
        altFormats: 'H:i',
        format: 'H:i',
        increment: 60,
        //minValue: '08:00',
        //maxValue: '18:00',
        editable: false,
        blankText: '时限时间必须选择',
        //anchor: '50%'
        value: '18:00',
        width: 90
    });
    var ticketNo = new Ext.form.TextField({
        fieldLabel: '票号',
        name: 'ticket_no',
        allowBlank: true,
        blankText: '票号必须填写',
        anchor: '90%'
    });
    var linkMan = new Ext.form.TextField({
        fieldLabel: '联系人',
        name: 'link_man',
        allowBlank: false,
        blankText: '联系人必须填写',
        anchor: '90%'
    });
    var linkPhone = new Ext.form.TextField({
        fieldLabel: '联系电话',
        name: 'link_tel',
        allowBlank: false,
        blankText: '联系电话必须填写',
        anchor: '90%'
    });
    var seatArray = [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']];
    var seat_default = 1;
    if (group_flag=="yes"){
        seatArray = [['10'], ['11'], ['12'], ['13'], ['14'], ['15'], ['16'], ['17'], ['18'], ['19'], ['20'], ['21'], ['22'], ['23'], ['24'], ['25'], ['26'], ['27'], ['28'], ['29'], ['30']];
        seat_default = 10;
    }
    var seatReader = new Ext.data.ArrayReader({}, ['value']);
    var seatStore = new Ext.data.Store({
        reader: seatReader,
        data: seatArray
    });
    //seatStore.loadData(seatArray);
    var seatNumber = new Ext.form.ComboBox({ //combobox
        name: 'seat_number',
        fieldLabel: '座位数',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'value',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: seat_default,
        store: seatStore //数据储存到这个comboBox
    });
    function seatSelect(){
        var selectedSeatNumber = parseInt(seatNumber.getValue());
        //Ext.MessageBox.alert('提示', selectedSeatNumber);
        //Ext.MessageBox.alert('提示', 'div_passenger_'+currentSeatNumber);
        ageType2.render();
        if (selectedSeatNumber == 1) {
            hideSeat();
        }
        else if (selectedSeatNumber > currentSeatNumber) {
            for (i = currentSeatNumber + 1; i <= selectedSeatNumber; i++) {
                //Ext.MessageBox.alert('提示', i);
                Ext.getCmp('div_passenger_' + i).show();
                eval('passengerName' + i + '.allowBlank=false');
                if (eval('ageType' + i).getValue() != "成人") {
                    eval('birthday' + i + '.allowBlank=false');
                }
            }
        }
        else {
            for (i = selectedSeatNumber + 1; i <= currentSeatNumber; i++) {
                //Ext.MessageBox.alert('提示', i);
                Ext.getCmp('div_passenger_' + i).hide();
                eval('birthday' + i + '.allowBlank=true');
                eval('passengerName' + i + '.allowBlank=true');
            }
        }
        currentSeatNumber = selectedSeatNumber;
    }
    if (!group_flag || group_flag!="yes"){
        seatNumber.on('select', seatSelect);
    }
    var orderOwner = new Ext.form.ComboBox({
        store: new Ext.data.Store({
            proxy: new Ext.data.HttpProxy({
                url: '/users/getAllUsersComboBox'
            }),
            reader: new Ext.data.JsonReader({
                root: 'root'
            }, [{
                    name: 'id'
                }, {
                    name: 'user_name'
                }])
        }),
        resiable: true,
        typeAhead: true,
        fieldLabel: '所有者',
        name: 'owner',
        loadingText: '正在加载...',
        //emptyText: '请选择...',
        displayField: 'user_name',
        valueField: 'id',
        mode: 'remote',
        //hideTrigger: true,
        triggerAction: 'all',
        //hiddenName: 'owner',//如果不想提交displayField，则在这儿指定以提交ID的值．
        //hiddenId:'owner',
        allowBlank: true,
        editable: false,
        //forceSelection: false,
        width: 90,
        //maxHeight: 150,
        tabIndex: 4,
        onSelect: function(record){
            //alert(record.data.user_name);
            owner.setValue(record.data.user_name);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    //常旅客关键字搜索
    var pass_resultTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{name} {card}</h3>', '</div></tpl>');
    var pass_nameStore = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
            url: "/customers/getPassengerComboBox"
        }),
        reader: new Ext.data.JsonReader({
            root: 'root'
        }, [{
                name: 'name'
            }, {
                name: 'phone'
            }, {
                name: 'card'
            }])
    });
    var passengerName1 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_1',
        allowBlank: false,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName1.setValue(record.data.name);
            card1.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card1 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_1',
        anchor: '90%'
    });
    var birthday1 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_1',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageTypeArray;
    if (app_flag == "yes") {
        ageTypeArray = [['成人', '成人'],['教师', '教师'],['学生', '学生'], ['儿童', '儿童'], ['婴儿', '婴儿']];
    }else{
        ageTypeArray = [['成人', '成人'], ['儿童', '儿童'], ['婴儿', '婴儿']];
    }
    var ageTypeStore = new Ext.data.Store({
        reader: new Ext.data.ArrayReader({}, ['key','value']),
        data: ageTypeArray
    });
    var ageType1 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_1',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100,
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday1.disable();
                    birthday1.allowBlank = true;
                    card1.enable();
                }
                else {
                    birthday1.enable();
                    birthday1.allowBlank = false;
                    card1.setValue('');
                    card1.disable();
                }
            }
        }
    });
    var insuranceArray = [['0', '0'], ['1', '1'], ['2', '2']];
    var insuranceReader = new Ext.data.ArrayReader({
        id: 0
    }, [{
            name: 'value'
        }, {
            name: 'key'
        }]);
    var insuranceStore = new Ext.data.Store({
        reader: insuranceReader
    });
    insuranceStore.loadData(insuranceArray);
    var insurance1 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_1',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //2
    var passengerName2 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_2',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName2.setValue(record.data.name);
            card2.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card2 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_2',
        anchor: '90%'
    });
    var birthday2 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_2',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType2 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_2',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday2.disable();
                    birthday2.allowBlank = true;
                    card2.enable();
                }
                else {
                    birthday2.enable();
                    birthday2.allowBlank = false;
                    card2.setValue('');
                    card2.disable();
                }
            }
        }
    });
    var insurance2 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_2',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //3
    var passengerName3 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_3',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName3.setValue(record.data.name);
            card3.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card3 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_3',
        anchor: '90%'
    });
    var birthday3 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_3',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType3 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_3',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday3.disable();
                    birthday3.allowBlank = true;
                    card3.enable();
                }
                else {
                    birthday3.enable();
                    birthday3.allowBlank = false;
                    card3.setValue('');
                    card3.disable();
                }
            }
        }
    });
    var insurance3 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_3',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //4
    var passengerName4 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_4',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName4.setValue(record.data.name);
            card4.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card4 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_4',
        anchor: '90%'
    });
    var birthday4 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_4',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType4 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_4',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday4.disable();
                    birthday4.allowBlank = true;
                    card4.enable();
                }
                else {
                    birthday4.enable();
                    birthday4.allowBlank = false;
                    card4.setValue('');
                    card4.disable();
                }
            }
        }
    });
    var insurance4 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_4',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //5
    var passengerName5 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_5',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName5.setValue(record.data.name);
            card5.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card5 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_5',
        anchor: '90%'
    });
    var birthday5 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_5',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType5 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_5',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday5.disable();
                    birthday5.allowBlank = true;
                    card5.enable();
                }
                else {
                    birthday5.enable();
                    birthday5.allowBlank = false;
                    card5.setValue('');
                    card5.disable();
                }
            }
        }
    });
    var insurance5 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_5',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //6
    var passengerName6 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_6',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName6.setValue(record.data.name);
            card6.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card6 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_6',
        anchor: '90%'
    });
    var birthday6 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_6',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType6 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_6',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday6.disable();
                    birthday6.allowBlank = true;
                    card6.enable();
                }
                else {
                    birthday6.enable();
                    birthday6.allowBlank = false;
                    card6.setValue('');
                    card6.disable();
                }
            }
        }
    });
    var insurance6 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_6',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //7
    var passengerName7 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_7',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName7.setValue(record.data.name);
            card7.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card7 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_7',
        anchor: '90%'
    });
    var birthday7 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_7',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType7 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_7',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday7.disable();
                    birthday7.allowBlank = true;
                    card7.enable();
                }
                else {
                    birthday7.enable();
                    birthday7.allowBlank = false;
                    card7.setValue('');
                    card7.disable();
                }
            }
        }
    });
    var insurance7 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_7',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    
    //8
    var passengerName8 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_8',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName8.setValue(record.data.name);
            card8.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card8 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_8',
        anchor: '90%'
    });
    var birthday8 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_8',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType8 = new Ext.form.ComboBox({ //combobox
        name: 'age_type_8',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday8.disable();
                    birthday8.allowBlank = true;
                    card8.enable();
                }
                else {
                    birthday8.enable();
                    birthday8.allowBlank = false;
                    card8.setValue('');
                    card8.disable();
                }
            }
        }
    });
    var insurance8 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_8',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //9
    var passengerName9 = new Ext.form.ComboBox({
        store: pass_nameStore,
        fieldLabel: '乘客姓名',
        name: 'pessenger_name_9',
        allowBlank: true,
        blankText: "乘客姓名不允许为空",
        //displayField: 'name',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 230,
        anchor: '90%',
        //hideTrigger: true,
        tpl: pass_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            passengerName9.setValue(record.data.name);
            card9.setValue(record.data.card);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var card9 = new Ext.form.TextField({
        fieldLabel: '证件号码',
        name: 'card_9',
        anchor: '90%'
    });
    var birthday9 = new Ext.form.DateField({
        fieldLabel: '生日',
        name: 'birthday_9',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        blankText: "出生日期必须选择",
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        //anchor: '50%'
        width: 90
    });
    var ageType9 = new Ext.form.ComboBox({
        name: 'age_type_9',
        fieldLabel: '类型',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: "成人",
        store: ageTypeStore,
        listeners: {
            select: function(combo, record, index){
                if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                    birthday9.disable();
                    birthday9.allowBlank = true;
                    card9.enable();
                }
                else {
                    birthday9.enable();
                    birthday9.allowBlank = false;
                    card9.setValue('');
                    card9.disable();
                }
            }
        }
    });
    var insurance9 = new Ext.form.ComboBox({ //combobox
        name: 'insurance_9',
        fieldLabel: '保险',
        resiable: true,
        typeAhead: true,
        handleHeight: 100, //
        displayField: 'key',
        valueField: 'value',
        selectOnFocus: true,
        mode: 'local',
        width: 60,
        triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
        readOnly: true,
        value: 0,
        store: insuranceStore
    });
    //送,接信息
    var sendTicketDate = new Ext.form.DateField({
        fieldLabel: '送票日期',
        name: 'send_date',
        altFormats: 'Y-m-d',
        format: 'Y-m-d', //格式化日期
        //disabledDays: [0,6],	//不让选择周六，周日
        //disabledDaysText: "周末要休息",
        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
        allowBlank: true,
        //emptyText: '请选择...',
        inputType: '2008-01-01',
        editable: false,
        minValue: today,
        //anchor: '50%'
        width: 90
    });
    var sendTicketTime = new Ext.form.TimeField({
        fieldLabel: '送票时间',
        name: 'send_time',
        altFormats: 'H:i',
        format: 'H:i',
        increment: 30,
        minValue: SEND_START_TIME,
        maxValue: SEND_END_TIME,
        editable: false,
        //anchor: '50%'
        width: 90
    });
    var jjTime = new Ext.form.TimeField({
        fieldLabel: '接机时间',
        name: 'jj_time',
        altFormats: 'H:i',
        format: 'H:i',
        increment: 60,
        minValue: JJ_START_TIME,
        maxValue: JJ_END_TIME,
        editable: false,
        //anchor: '50%'
        width: 90
    });
    //送票地址关键字搜索
    var address_resultTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{address}</h3>', '</div></tpl>');
    var sendAddress = new Ext.form.ComboBox({
        store: new Ext.data.Store({
            proxy: new Ext.data.HttpProxy({
                url: '/customers/getAddressComboBox?id=' + addMul_customer_id
            }),
            reader: new Ext.data.JsonReader({
                root: 'root'
            }, [{
                    name: 'address'
                }])
        }),
        fieldLabel: '送票地址',
        name: 'send_address',
        allowBlank: true,
        blankText: "送票地址不允许为空",
        anchor: '90%',
        value: addMul_address,
        displayField: 'title',
        typeAhead: false,
        loadingText: 'Searching...',
        //width: 250,
        hideTrigger: false,
        tpl: address_resultTpl,
        minChars: 0,
        itemSelector: 'div.search-item',
        onSelect: function(record){
            sendAddress.setValue(record.data.address);
            if (this.isExpanded()) {
                this.collapse();
            }
        }
    });
    var sendRequest = new Ext.form.TextField({
        fieldLabel: '送票要求',
        name: 'send_request',
        anchor: '90%'
    });
    var jjAddress = new Ext.form.TextField({
        fieldLabel: '接机地址',
        name: 'jj_address',
        anchor: '90%',
        value: DEFAULT_JJ_ADDRESS
    });
    var jjRequest = new Ext.form.TextField({
        fieldLabel: '接机要求',
        name: 'jj_request',
        anchor: '90%'
    });
    var addNewCustomerButton = new Ext.Button({
        text: '添加客户',
        handler: addCustomer_1
    })
    function addCustomer_1(){
        alert(phone_number);
        CreateCustomer_1(phone_number);
    }
    var submitButton = new Ext.Button({
        text: ' 提 交 ',
        handler: function(){
            if (bookingTicketsFormPanel.form.isValid()) {
                submitButton.setDisabled(true);
                bookingTicketsFormPanel.form.submit({
                    waitMsg: '正在提交中......',
                    success: function(form, action){
                        var info = "";
                        if (action && action.result) {
                            info = action.result.info;
                        }
                        else {
                            info = '订票失败,具体失败原因请查询日志文件';
                        }
                        if (info.indexOf("成功") >= 0) {
                            Ext.MessageBox.alert('订票成功', info + '<br> 将转回来电显示页面');
                            var tabs = Ext.getCmp('tabs');
                            var url = '/customers/customerInfoByID?id='+addMul_customer_id;
                            var customer_info_tab = Ext.getCmp('phoneshow_tab0');
                            if (customer_info_clikced){
                                customer_info_tab.getUpdater().update(url);
                            }else{
                                customer_info_tab.autoLoad.url=url;
                            }
                            tabs.activate(customer_info_tab);
                        }
                        else {
                            Ext.MessageBox.alert('操作信息', info);
                            submitButton.setDisabled(false);
                        }
                    },
                    failure: function(form, action){
                        var info = "";
                        if (action && action.result) {
                            info = action.result.info;
                        }
                        else {
                            info = '订票失败,具体失败原因请查询日志文件';
                        }
                        Ext.MessageBox.alert('操作失败', info);
                        submitButton.setDisabled(false);
                    }
                });
            }else{
                Ext.MessageBox.alert('提示', '请填写必填信息后再提交');
            }
        }
    })
    
    //---------------------Create Customer------------------------
    function CreateCustomer_1(phoneNumber){
        // pre-define fields in the form
        var newCustomerName = new Ext.form.TextField({
            fieldLabel: "<span class='red'>*</span>客户名称",
            allowBlank: false,
            name: 'name',
            anchor: '90%'
        });
        var customerNo = new Ext.form.TextField({
            fieldLabel: '会员卡号',
            //allowBlank: false,
            name: 'customer_no',
            anchor: '90%'
        });
        var birthDay = new Ext.form.DateField({
            fieldLabel: '生日',
            name: 'birthday',
            format: 'Y-m-d', //格式化日期
            //disabledDays: [0,6],	//不让选择周六，周日
            //disabledDaysText: "周末要休息",
            invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
            allowBlank: true,
            inputType: '2008-01-01',
            anchor: '90%'
            //value:'1975-01-01'
            //maxValue:'1925-01-01'
        });
        var customerType = new Ext.form.ComboBox({
            store: new Ext.data.Store({
                proxy: new Ext.data.HttpProxy({
                    url: '/admin/getCustomerTypes'
                }),
                reader: new Ext.data.JsonReader({
                    root: 'root',
                    id: 'id'
                }, ['id', 'customer_type'])
            }),
            name: 'customer_type',
            loadingText: '正在加载...',
            displayField: 'customer_type',
            valueField: 'id',
            mode: 'remote',
            triggerAction: 'all',
            hiddenName: 'customer_type_id',
            fieldLabel: "<span class='red'>*</span>客户类型",
            emptyText: '请选择...',
            editable: false,
            allowBlank: false,
            width: 70,
            maxHeight: 150,
            tabIndex: 4
        });
        //card type
        var cardType = new Ext.form.ComboBox({
            store: new Ext.data.Store({
                proxy: new Ext.data.HttpProxy({
                    url: '/admin/getCardTypes'
                }),
                reader: new Ext.data.JsonReader({
                    root: 'root',
                    id: 'id'
                }, ['id', 'card_type'])
            }),
            name: 'card_type',
            loadingText: '正在加载...',
            //displayField: 'customer_type',
            displayField: 'card_type',
            valueField: 'id',
            mode: 'remote',
            triggerAction: 'all',
            hiddenName: 'card_type_id',//如果不想提交displayField，则在这儿指定以提交ID的值．
            //hiddenId:'type_id',
            fieldLabel: '证件类型',
            emptyText: '请选择...',
            editable: false,
            //allowBlank: false,
            width: 60,
            maxHeight: 150,
            tabIndex: 4
        });
        // sex combobox
        var sexArray = [['m', '男'], ['f', '女']];
        var sexReader = new Ext.data.ArrayReader({
            id: 0
        }, [{
                name: 'value'
            }, {
                name: 'key'
            }]);
        var sexStore = new Ext.data.Store({
            reader: sexReader
        });
        sexStore.loadData(sexArray);
        var sex = new Ext.form.ComboBox({ //combobox
            name: 'sex',
            fieldLabel: "<span class='red'>*</span>性别",
            resiable: true,
            typeAhead: true,
            handleHeight: 100, //
            displayField: 'key',
            valueField: 'value',
            selectOnFocus: true,
            mode: 'local',
            selectOnFocus: true,
            triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
            readOnly: true,
            allowBlank: false,
            emptyText: '选择类型...',
            store: sexStore, //数据储存到这个comboBox
            anchor: '90%'
        });
        // level combobox
        var levelArray = [['普通会员', '普通会员'], ['个人客户', '个人客户'], ['VIP', 'VIP'], ['集团客户', '集团客户']];
        var levelReader = new Ext.data.ArrayReader({
            id: 0
        }, [{
                name: 'value'
            }, {
                name: 'key'
            }]);
        var levelStore = new Ext.data.Store({
            reader: levelReader
        });
        levelStore.loadData(levelArray);
        var customerLevel = new Ext.form.ComboBox({ //combobox
            name: 'customer_level',
            fieldLabel: '客户级别',
            resiable: true,
            typeAhead: true,
            handleHeight: 100, //
            displayField: 'key',
            valueField: 'value',
            selectOnFocus: true,
            mode: 'local',
            triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
            readOnly: true,
            emptyText: '选择类型...',
            store: levelStore //数据储存到这个comboBox
        });
    
        var customerAddress = new Ext.form.TextField({
            fieldLabel: '地址',
            //allowBlank: false,
            name: 'address',
            anchor: '90%'
        });
        var card = new Ext.form.TextField({
            fieldLabel: '证件号码',
            //allowBlank: false,
            name: 'card',
            anchor: '90%'
        });
        var phone = new Ext.form.TextField({
            fieldLabel: "<span class='red'>*</span>电话",
            allowBlank: false,
            name: 'phone',
            anchor: '90%'
        });
        if (phoneNumber) {
            phone.setValue(phoneNumber);
        }
        var linkman = new Ext.form.TextField({
            fieldLabel: '联系人',
            //allowBlank: false,
            name: 'linkman',
            anchor: '90%'
        });
        var linkmanPhone = new Ext.form.TextField({
            fieldLabel: '联系人电话',
            //allowBlank: false,
            name: 'linkman_phone',
            anchor: '90%'
        });
        var formPanel = new Ext.form.FormPanel({
            //baseCls: 'x-plain',
            labelWidth: 75,
            labelAlign: 'right',
            frame: true,
            //url: '/customers/addCustomer',
            //defaultType: 'textfield',
            items: [{
                    layout: 'column',
                    border: false,
                    items: [{
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [newCustomerName]
                        }, {
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [customerNo]
                        }]
                }, {
                    layout: 'column',
                    border: false,
                    items: [{
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [sex]
                        }, {
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [customerType]
                        }]
                }, {
                    layout: 'column',
                    border: false,
                    items: [{
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [phone]
                        }, {
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [birthDay]
                        }]
                }, customerAddress, {
                    layout: 'column',
                    border: false,
                    items: [{
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [cardType]
                        }, {
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [card]
                        }]
                }, {
                    layout: 'column',
                    border: false,
                    items: [{
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [linkman]
                        }, {
                            columnWidth: .5,
                            layout: 'form',
                            border: false,
                            items: [linkmanPhone]
                        }]
                }]//, customerLevel]
        });
    
        // define window and show it in desktop
        var window = new Ext.Window({
            title: '增加新客户',
            minimizable: true,
            maximizable: true,
            width: 500,
            height: 250,
            minWidth: 500,
            minHeight: 250,
            layout: 'fit',
            plain: true,
            bodyStyle: 'padding:5px;',
            buttonAlign: 'center',
            items: formPanel,
            modal: true,
            buttons: [{
                    text: '增加',
                    handler: function(){
                        // check form value
                        //身份证验证
                        var isCard = true;
                        if (card.getValue().length>0&&cardType.getValue()=="1"){
                            if (!isSFZ(card.getValue())){
                                isCard = false;
                            }
                        }
                        if (formPanel.form.isValid()&&isCard) {
                            Ext.Ajax.request({
                                url: '/customers/addCustomer',
                                params: formPanel.form.getValues(true),
                                method: 'POST',
                                success: function(result, request){
                                    if (result.responseText.indexOf("添加客户成功")>=0) {
                                        alert(result.responseText);
                                        //Ext.MessageBox.alert('提示', '增加新客户成功');
                                        window.destroy();
                                        if (phoneNumber) {
                                            var str = result.responseText;
                                            str = str.substring(str.indexOf("-id=")+4);
                                            addMul_customer_id = str.substring(0,str.indexOf(" "));
                                            addMul_customer_name = str.substring(str.indexOf("-name=")+6);
                                            //alert(addMul_customer_id+"--"+addMul_customer_name);
                                            
                                            customerName.setValue(addMul_customer_name);
                                            var pars = paramStr.substring(paramStr.indexOf("&"));
                                            //alert(pars);
                                            paramStr = "customerid=" + addMul_customer_id + pars;
                                            //alert(paramStr);
                                        }
                                    }
                                    else {
                                        Ext.MessageBox.alert('消息', result.responseText);
                                    }
                                },
                                failure: function(result, request){
                                    Ext.MessageBox.alert('Failed', 'Not be found!');
                                }
                            });
                        }
                        else {
                            Ext.MessageBox.alert('错误提示', '请按要求填写必输选项.');
                        }
                    }
                }, {
                    text: '取消',
                    handler: function(){
                        window.destroy();
                    }
                }]
        });
    
        window.show();
    };

    var bookingTicketsFormPanel = new Ext.form.FormPanel({
        //baseCls: 'x-plain',
        labelWidth: 60,
        labelAlign: 'right',
        frame: true,
        width: '100%',
        url: '/orders/saveMulOrder?' + paramStr,
        //params: paramStr,
        //defaultType: 'textfield',
        items: [{
                layout: 'column',
                border: false,
                items: [{
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [customerName]
                    }, {
                        columnWidth: .6,
                        layout: 'form',
                        border: false,
                        items: [orderRequest]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [addNewCustomerButton]
                    }]
            }, flightInfo, {
                layout: 'column',
                border: false,
                id: 'div_flightInfo2',
                items: [{
                        columnWidth: 1,
                        layout: 'form',
                        border: false,
                        items: [flightInfo2]
                    }]
            }, {
                layout: 'column',
                border: false,
                id: 'div_flightInfo3',
                items: [{
                        columnWidth: 1,
                        layout: 'form',
                        border: false,
                        items: [flightInfo3]
                    }]
            }, {
                layout: 'column',
                border: false,
                id: 'div_flightInfo4',
                items: [{
                        columnWidth: 1,
                        layout: 'form',
                        border: false,
                        items: [flightInfo4]
                    }]
            }, {
                layout: 'column',
                border: false,
                items: [{
                        columnWidth: .11,
                        layout: 'form',
                        border: false,
                        items: [HKFixType]
                    }, {
                        columnWidth: .04,
                        layout: 'form',
                        border: false,
                        items: [RRFixType]
                    }, {
                        columnWidth: .05,
                        layout: 'form',
                        border: false,
                        items: [LLFixType]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [outTicketStatus]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [affirmDate]
                    }]
            }, {
                layout: 'column',
                border: false,
                id: 'div_tktl',
                items: [{
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [tktlDate]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [tktlTime]
                    }]
            }, {
                layout: 'column',
                border: false,
                id: 'div_ticketno',
                items: [{
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [ticketNo]
                    }]
            }, {
                layout: 'column',
                border: false,
                items: [{
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [linkMan]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [linkPhone]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [seatNumber]
                    }, {
                        columnWidth: .2,
                        layout: 'form',
                        border: false,
                        items: [orderOwner]
                    }]
            }, {
                id: 'div_passenger',
                xtype: 'fieldset',
                title: '常旅客信息',
                collapsible: true,
                autoHeight: true,
                items: [{
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_1',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName1]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card1]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType1]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday1]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance1]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_2',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName2]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card2]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType2]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday2]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance2]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_3',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName3]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card3]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType3]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday3]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance3]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_4',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName4]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card4]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType4]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday4]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance4]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_5',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName5]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card5]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType5]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday5]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance5]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_6',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName6]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card6]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType6]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday6]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance6]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_7',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName7]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card7]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType7]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday7]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance7]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_8',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName8]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card8]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType8]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday8]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance8]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        id: 'div_passenger_9',
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [passengerName9]
                            }, {
                                columnWidth: .25,
                                layout: 'form',
                                border: false,
                                items: [card9]
                            }, {
                                columnWidth: .15,
                                layout: 'form',
                                border: false,
                                items: [ageType9]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [birthday9]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [insurance9]
                            }]
                    }]
            }, {
                xtype: 'fieldset',
                title: '送票与接机信息',
                collapsible: true,
                autoHeight: true,
                items: [{
                        layout: 'column',
                        border: false,
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [sendTicketDate]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [sendTicketTime]
                            }, {
                                columnWidth: .4,
                                layout: 'form',
                                border: false,
                                items: [sendAddress]
                            }, {
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [sendRequest]
                            }]
                    }, {
                        layout: 'column',
                        border: false,
                        items: [{
                                columnWidth: .2,
                                layout: 'form',
                                border: false,
                                items: [jjTime]
                            }, {
                                columnWidth: .4,
                                layout: 'form',
                                border: false,
                                items: [jjAddress]
                            }, {
                                columnWidth: .4,
                                layout: 'form',
                                border: false,
                                items: [jjRequest]
                            }]
                    }]
            }],
        buttons: [submitButton]
    });
    //申请单
    if (app_flag == "yes") {
        LLFixType.checked = true;
        HKFixType.checked = false;
        HKFixType.disable();
        RRFixType.disable();
    }else{
        LLFixType.disable();
    }
    //隐藏往返航班
    if (addMul_trip_type == "") {
        Ext.getCmp('div_flightInfo2').hide();
        Ext.getCmp('div_flightInfo3').hide();
        Ext.getCmp('div_flightInfo4').hide();
    }
    else if (addMul_trip_type == "wf" || addMul_trip_type == "lc") {
        Ext.getCmp('div_flightInfo3').hide();
        Ext.getCmp('div_flightInfo4').hide();
    }
    //提前隐藏RR方式
    Ext.getCmp('div_ticketno').hide();
    Ext.getCmp('div_tktl').show();
    //隐藏座位
    function hideSeat(){
        for (i = 2; i < 10; i++) {
            //Ext.MessageBox.alert('提示', 'div_passenger_'+i.toString());
            Ext.getCmp('div_passenger_' + i).hide();
        }
    }
    //hideSeat();
    birthday1.disable();
    birthday2.disable();
    birthday3.disable();
    birthday4.disable();
    birthday5.disable();
    birthday6.disable();
    birthday7.disable();
    birthday8.disable();
    birthday9.disable();
    
    bookingTicketsFormPanel.render('booking_tickets');
    if (!group_flag || group_flag!="yes"){
        hideSeat();
    }else{
        //隐藏常旅客
        Ext.getCmp('div_passenger').hide();
        passengerName1.allowBlank=true;
    }
})
